package servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSON;

import dao.OyxCollectionMessageDao;
import dao.impl.OyxCollectionMessageDaoImpl;


public class OyxDeleteCollectionServlet extends HttpServlet {
	
	OyxCollectionMessageDao cmd= new OyxCollectionMessageDaoImpl();
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");	
		String parameter = request.getParameter("collectionPageNo");
     	int parseInt = Integer.parseInt(parameter);
     	String collection_id = request.getParameter("collection_id");
     	int collection_idInt = Integer.parseInt(collection_id);
     	String user_id = request.getParameter("user_id");
     	int user_idInt = Integer.parseInt(user_id);
     	
     	System.out.println("当前分页"+parseInt);
     	System.out.println("商品id"+collection_idInt);
     	System.out.println("用户id"+user_idInt);
     	
     	Integer deleteCollection = cmd.deleteCollection(user_idInt, collection_idInt);
     	System.out.println(deleteCollection+"   删除条数");
		response.getWriter().print(JSON.toJSONString(parseInt));
		
		
	}

	
	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
